package com.air.ota.vo;

import com.air.ota.util.HexStringUtil;

public class UTKCancelInitDownlinkVO extends UTKBaseDownlinkVO {
	
	protected byte[] cardAppSequence;
	protected byte[] cancelSequence;
	
	protected byte   pwdAuthResult;
	
	protected byte[] descLength;
	protected byte[] desc;
	
	protected byte[] transDate;
	protected byte[] mac1;
	protected byte[] offlineTrans;
	
	
	public UTKCancelInitDownlinkVO(byte[] cardSequence,byte[] pkgSequence,
			byte[] cardAppSequence,byte[] cancelSequence,
			byte pwdAuthResult,byte[] desc,
			byte[] transDate,byte[] mac1,byte[] offlineTrans){
		super(cardSequence,pkgSequence);
		this.cmdType = 0x18;
		
		this.cardAppSequence = cardAppSequence;
		this.cancelSequence = cancelSequence;
		this.pwdAuthResult = pwdAuthResult;
		
		
		String cmdDataHexString="";
		
		if (pwdAuthResult==0x00){
			
			this.descLength = new byte[0];
			this.desc = new byte[0];
			this.transDate = transDate;
			this.mac1  = mac1;
			this.offlineTrans = offlineTrans;
			
			cmdDataHexString=HexStringUtil.bytesToHexString(this.cardAppSequence)+
				HexStringUtil.bytesToHexString(this.cancelSequence)+
				HexStringUtil.byteToHexString(this.pwdAuthResult)+
				HexStringUtil.bytesToHexString(this.transDate)+
				HexStringUtil.bytesToHexString(this.mac1)+
				HexStringUtil.bytesToHexString(this.offlineTrans)+
				HexStringUtil.bytesToHexString(this.pkgSequence);
			
		}else{
			this.transDate = new byte[0];
			this.mac1 = new byte[0];
			this.offlineTrans = new byte[0];
			
			
			this.descLength = new byte[1];
			this.descLength[0] = (byte) desc.length;
			this.desc = desc;
			
			cmdDataHexString=HexStringUtil.bytesToHexString(this.cardAppSequence)+
				HexStringUtil.bytesToHexString(this.cancelSequence)+
				HexStringUtil.byteToHexString(this.pwdAuthResult)+
				HexStringUtil.bytesToHexString(this.descLength)+
				HexStringUtil.bytesToHexString(this.desc)+
				HexStringUtil.bytesToHexString(this.pkgSequence);
			
		}
		
		
		System.out.println("Cancel Init downlinkVO cmdDataHex="+cmdDataHexString);
		this.cmdData = HexStringUtil.hexStringToBytes(cmdDataHexString);
		
	}
	
	/*public UTKCancelInitDownlinkVO(byte[] cardSequence,byte[] pkgSequence,
			byte[] cardAppSequence,byte[] cancelSequence,
			byte pwdAuthResult,byte[] desc,
			byte[] transDate,byte[] mac1,byte[] offlineTrans){
		super(cardSequence,pkgSequence);
		this.cmdType = 0x18;
		this.pwdAuthResult = pwdAuthResult;
		
		if (pwdAuthResult==0x00){
			
			this.descLength = new byte[0];
			this.desc = new byte[0];
			this.transDate = transDate;
			this.mac1  = mac1;
			this.offlineTrans = offlineTrans;
			
		}else{
			this.transDate = new byte[0];
			this.mac1 = new byte[0];
			this.offlineTrans = new byte[0];
			
			
			this.descLength = new byte[1];
			this.descLength[0] = (byte) desc.length;
			this.desc = desc;
			
		}
		
		String cmdDataHexString=HexStringUtil.bytesToHexString(this.cardAppSequence)+
		HexStringUtil.bytesToHexString(this.cancelSequence)+
		HexStringUtil.byteToHexString(this.pwdAuthResult)+
		HexStringUtil.bytesToHexString(this.descLength)+
		HexStringUtil.bytesToHexString(this.desc)+
		HexStringUtil.bytesToHexString(this.transDate)+
		HexStringUtil.bytesToHexString(this.mac1)+
		HexStringUtil.bytesToHexString(this.offlineTrans)+
		HexStringUtil.bytesToHexString(this.pkgSequence);
		
		this.cmdData = HexStringUtil.hexStringToBytes(cmdDataHexString);
		
	}*/
	
	
	/*
	public UTKCancelInitDownlinkVO(byte[] cardSequence,byte[] pkgSequence,
			byte[] cardAppSequence,byte[] cancelSequence,byte[] transDate,
			byte[] mac1,byte[] offlineTrans){
		
		super(cardSequence,pkgSequence);
		this.cmdType = 0x18;
		
		this.cardAppSequence = cardAppSequence;
		this.cancelSequence = cancelSequence;
		this.transDate = transDate;
		this.mac1 = mac1;
		this.offlineTrans = offlineTrans;
		
		
		String cmdDataHexString=HexStringUtil.bytesToHexString(this.cardAppSequence)+
			HexStringUtil.bytesToHexString(this.cancelSequence)+
			HexStringUtil.bytesToHexString(this.transDate)+
			HexStringUtil.bytesToHexString(this.mac1)+
			HexStringUtil.bytesToHexString(this.offlineTrans)+
			HexStringUtil.bytesToHexString(this.pkgSequence);
		
		
		
		this.cmdData = HexStringUtil.hexStringToBytes(cmdDataHexString);
		
	}*/
	
}
